<?php include("src/addAdviser_cs.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href='css/coolMessage.css' type='text/css' rel='stylesheet' media='screen' />
<title>Adicionar Asesor :: ASSC</title>
<script language="javaScript" type="text/javascript" src="js/jquery.js"></script>
<script language="javaScript" type="text/javascript" src="js/jquery.simplemodal.js"></script>
<script language="javaScript" type="text/javascript" src="js/coolMessage.js"></script>


<script language="javascript" type="text/javascript">
	
	var displayRow = '';
	if (navigator.appName == "Netscape")
		displayRow = 'table-row';
	else if (navigator.appName.indexOf("Explorer") != -1) 
		displayRow = 'block';

	var cont = 1;
	var maximum = 5
	function most(){
		document.getElementById("tr_phones").style.display = displayRow;
		if (cont < maximum ){
			cont++;
			$("#div_campo").append("<div id='div_tel_number_"+cont+"'>"+cont+". <input type='text' id='tel_number_"+cont+"' name='tel_number[]' class='text_grv' size='15' maxlength='14'/> <input type='text' id='tel_ext_"+cont+"' name='tel_ext[]' class='text_grv' size='3' maxlength='5'/></div>");
		}
		if(cont >0)
			document.getElementById('btnLess').disabled = 0;
	}
	
	function less(){
		if( cont == 2 )
			document.getElementById("tr_phones").style.display = 'none';
		
		if(cont > 1 ){
			$("#div_tel_number_"+cont).remove();
			cont--;
		}   
		if(cont == 1)
			document.getElementById('btnLess').disabled = 1;
	}	
	
	function isMail(valor) {
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor))
			return (true);
		else
			return (false);
	}

	function validate(action){
		document.getElementById("action").value = action;//1: save, 2: save and continue.
		
		var msg = '';
		var name   			= document.getElementById("ase_name").value;
		var cedula   		= document.getElementById("ase_ced").value;
			
		if(name == '') 
			msg='- Por favor entre el nombre del Asesor. <br />';
			
		if(cedula == '') 
			msg='- Por favor entre la cedula del Asesor. <br />';
			
//		if(cli_email == '') 
//			msg='- Please enter the email. <br />';
//		else{
//			if ( ! isMail (cli_email) )
//				msg += '- Wrong email.<br />';
//		}
		


		if(msg==''){
			document.getElementById('form').submit();
			return true;
		}
		else{
			coolMessage("alert", msg);
			return false;
		}		
	}
	

	function onlyNumbers(e)
	{
	   var key;
	   if(window.event)
		  key = window.event.keyCode;   //IE
	   else
		  key = e.which;                //firefox
	   if (!( (key >= 48 && key <= 57) || key ==8 || key ==9 || key ==0 || key ==46 ))
		  return false;
	   else
		  return true;
	}	
	
</script>
</head>
<body>
<?php $item_select = 10;include("menu.php");?><br />
    <form name="form" id="form" method="post" action="" enctype="multipart/form-data">
    <input type="hidden" name="addAdviser" id="addAdviser" value="1"/>
	<input type="hidden" name="action" id="action" value="1"/>
    
    <div class="content_grv">
		<table width="80%" align="center" class="shadow">
            <tr>
                <td class="title">Informacion Asesor</td>
            </tr>
            <tr>
                <td>
                    <table class="tbl_form" align="center">
                        <tr>
                            <td width="35%" align="right"><span class="lbl_gray">Nombre:</span></td>
                            <td width="1%">&nbsp;</td>
                            <td><input type="text" name="ase_name" id="ase_name" class="text_grv" size="31" maxlength="30" /></td>
                        </tr>

                        <tr>
                            <td width="35%" align="right"><span class="lbl_gray">Cedula:</span></td>
                            <td width="1%">&nbsp;</td>
                            <td><input type="text" name="ase_ced" id="ase_ced" class="text_grv" size="21" maxlength="20" /></td>
                        </tr>
                        <tr>
                        	<td align="right"><span class="lbl_gray">Celular:</span><br /><span class="lbl_gray_small">Telefono :</span></td>
                            <td>&nbsp;</td>
                            <td>                                    
                                1. <input type="text" name="tel_number[]" id="tel_number_1" class="text_grv" size="15" maxlength="14" />
                                <input type="text" name="tel_ext[]" id="tel_ext_1" class="text_grv" size="3" maxlength="5" />
                                <input type="button" value="+" onClick="javascript: most();" class="button_grv"/>&nbsp;
                                <input type="button" value="-" id="btnLess" onClick="javascript: less()" class="button_grv_cancel" disabled="disabled"/>
                            </td>
                        </tr>
                        <tr id="tr_phones" style="display:none">
                        	<td align="right" valign="top"><span class="lbl_gray">Mas Telefonos:</span></td>
                            <td>&nbsp;</td>
                            <td>
                            	<div id="div_campo">
                                
                                </div>
                            </td>
                        </tr>

                        <tr>
                            <td align="right"><span class="lbl_gray">Email:</span></td>
                            <td>&nbsp;</td>
                            <td><input type="text" name="ase_email" id="ase_email" class="text_grv" size="51"  maxlength="50" /></td>
                        </tr>
                        <tr>
                            <td colspan="3" align="center">&nbsp;</td>
                        </tr>
                        <tr>
                            <td colspan="3" align="center">
                                <input type="button" class="button_grv" value="Save" onclick="javascript: return validate(1);" />
                                <input type="button" class="button_grv" value="Save and continue" onclick="javascript: return validate(2);" />
                                <input type="reset" value="Reset" class="button_grv_cancel"/>
                                <input type="button" class="button_grv_cancel" value="Cancel" onClick="javascript:window.location.href='listAdviserphp';" />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
 	</div>
</form>    
</body>
</html>
<?php include('divscoolmessage.php');?>